package cn.jtfadmin.sysmonitor.controller;

import cn.jtfadmin.base.lang.common.domain.dto.ResultDTO;
import cn.jtfadmin.sysmonitor.domain.dto.ComputerSystemInfoDTO;
import cn.jtfadmin.sysmonitor.domain.dto.DiskInfoDTO;
import cn.jtfadmin.sysmonitor.domain.dto.MemoryInfoDTO;
import cn.jtfadmin.sysmonitor.domain.dto.ProcessorInfoDTO;
import cn.jtfadmin.sysmonitor.service.SystemInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 服务器硬件监控Controller
 * @author jtf
 * @since 0.0.2
 */
@RestController
public class HardwareMonitorController {


    @Autowired
    private SystemInfoService service;

    /**
     * 获取磁盘信息
     * @return 磁盘信息
     */
    @GetMapping(value = "/monitor/hardware/getDiskInfo")
    public ResultDTO<List<DiskInfoDTO>> getDiskInfo(){
       return ResultDTO.successData(service.getDiskInfo());
    }

    /**
     * 获取计算机硬件信息
     * @return
     */
    @GetMapping(value = "/monitor/hardware/getComputerSystemInfo")
    public ResultDTO<ComputerSystemInfoDTO> getComputerSystemInfo(){
        return ResultDTO.successData(service.getComputerSystemInfo());
    }


    /**
     * 获取cpu信息
     * @return cpu 信息
     */
    @GetMapping(value = "/monitor/hardware/getProcessorInfo")
    public ResultDTO<ProcessorInfoDTO> getProcessorInfo(){
        return ResultDTO.successData(service.getProcessorInfo());
    }

    /**
     * 获取内存信息
     * @return 内存 信息
     */
    @GetMapping(value = "/monitor/hardware/getMemoryInfo")
    public ResultDTO<MemoryInfoDTO> getMemoryInfo(){
        return ResultDTO.successData(service.getMemoryInfo());
    }


}
